

#ifndef MEMORYTABLE_H_
#define MEMORYTABLE_H_

#include <set>
#include <string>
#include "../../Packets/PubPkt.h"
#include "../../Packets/BackSubPkt.h"
#include "../../Common/Consts.h"

class Comparison {
public:

	bool operator() (const std::pair<timestamp_t, key_t>& lhs, const std::pair<timestamp_t, key_t>& rhs) const {
		if (lhs.first == rhs.first)
			return lhs.second > rhs.second;
		else
			return (lhs.first > rhs.first);
	}
};


class MemoryTable {

public:

	virtual void updateTable(std::string type, int subscriptionCount, float window, bool resettable, int eventCount) = 0;

	virtual void resetTable() = 0;

	virtual void fixTable() = 0;

	virtual void computeInsertion(PubPkt *pkt, std::string complexType) = 0;

	virtual /*std::set<PubPkt*>*/void computeExtraction(BackSubPkt *pkt, std::set<PubPkt*> &resultSet) = 0;

};

#endif /* MEMORYTABLE_H_ */

